Skip to content

fix(ci): skip import profiler on python version mismatch during install - #17784

Closed
hebaalazzeh wants to merge 1 commit into
mainfrom
fix/import-profiler-python-requires
Closed

fix(ci): skip import profiler on python version mismatch during install#17784
hebaalazzeh wants to merge 1 commit into
mainfrom
fix/import-profiler-python-requires

Conversation

@hebaalazzeh

Copy link
Copy Markdown
Contributor

This PR resolves CI check failures on packages (such as sqlalchemy-bigquery) that restrict Python versions using python_requires constraints (e.g. <3.15) when executing the import profiler on Python 3.15.

Key Changes

  • Python Compatibility Guard: Updated ci/run_single_test.sh to capture the output of pip install -e . and inspect the stderr for "requires a different Python".
  • Graceful Skip: If a package is incompatible with the GHA Python runtime version, the script prints a warning and exits cleanly with status 0, gracefully skipping the import profiler run instead of crashing the job.
  • Failure Resilience: Any installation errors unrelated to Python version constraints will still correctly exit with a non-zero code to fail the build check.

@hebaalazzeh hebaalazzeh self-assigned this Jul 20, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the CI script ci/run_single_test.sh to capture the output of pip install and handle Python version incompatibility gracefully. The review feedback suggests deduplicating the cleanup logic (deactivating the virtual environment and removing temporary directories) within the error handling block to simplify the code.

Comment thread ci/run_single_test.sh
Comment on lines +142 to +157
if [ ${pip_retval} -ne 0 ]; then
echo "${pip_output}"
if echo "${pip_output}" | grep -q "requires a different Python"; then
echo "WARNING: Package ${PACKAGE_NAME} is not compatible with Python ${PY_VERSION}. Skipping import profiler."
deactivate
rm -rf .venv-profiler
rm -rf "${PROFILER_TEMP_DIR}"
exit 0
else
echo "ERROR: Failed to install package ${PACKAGE_NAME}."
deactivate
rm -rf .venv-profiler
rm -rf "${PROFILER_TEMP_DIR}"
exit ${pip_retval}
fi
fi

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The cleanup logic (deactivate and removing temporary directories) is duplicated in both branches of the conditional check. This can be simplified by performing the cleanup immediately after printing the pip output, before checking the specific error message.

Suggested change
if [ ${pip_retval} -ne 0 ]; then
echo "${pip_output}"
if echo "${pip_output}" | grep -q "requires a different Python"; then
echo "WARNING: Package ${PACKAGE_NAME} is not compatible with Python ${PY_VERSION}. Skipping import profiler."
deactivate
rm -rf .venv-profiler
rm -rf "${PROFILER_TEMP_DIR}"
exit 0
else
echo "ERROR: Failed to install package ${PACKAGE_NAME}."
deactivate
rm -rf .venv-profiler
rm -rf "${PROFILER_TEMP_DIR}"
exit ${pip_retval}
fi
fi
if [ ${pip_retval} -ne 0 ]; then
echo "${pip_output}"
deactivate
rm -rf .venv-profiler
rm -rf "${PROFILER_TEMP_DIR}"
if echo "${pip_output}" | grep -q "requires a different Python"; then
echo "WARNING: Package ${PACKAGE_NAME} is not compatible with Python ${PY_VERSION}. Skipping import profiler."
exit 0
else
echo "ERROR: Failed to install package ${PACKAGE_NAME}."
exit ${pip_retval}
fi
fi

@hebaalazzeh
hebaalazzeh deleted the fix/import-profiler-python-requires branch July 20, 2026 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant